import { request } from 'umi';

import { RunAlarmParamsType } from './API';

//实时告警
export async function queryRunAlarmAPI(params?: RunAlarmParamsType) {
  return request<API.APIReturnType<any>>('/api/alarm/runAlarm', { params: params || {} });
}
export async function queryRunAlarmChartAPI(params?: { type: string }) {
  return request<API.APIReturnType<any>>('/api/alarm/runAlarmChart', { params: params || {} });
}
export async function queryRunAlarmPieAPI() {
  return request<API.APIReturnType<any>>('/api/alarm/runAlarmPie');
}
//历史告警
export async function queryHisAlarmAPI(params?: RunAlarmParamsType) {
  return request<API.APIReturnType<any>>('/api/alarm/hisAlarm', { params: params || {} });
}
export async function queryHisAlarmChartAPI(params?: { type: string }) {
  return request<API.APIReturnType<any>>('/api/alarm/hisAlarmChart', { params: params || {} });
}
export async function queryRunAlarmCountAPI() {
  return request<API.APIReturnType<any>>('/api/alarm/runAlarmCount');
}
export async function cancelAlarmAPI(params?: { alarmID: string }) {
  return request<API.APIReturnType<any>>('/api/alarm/cancelAlarm', {
    method: 'post',
    data: params || {},
  });
}
export async function endAlarmAPI(params?: { alarmID: string }) {
  return request<API.APIReturnType<any>>('/api/alarm/endAlarm', {
    method: 'post',
    data: params || {},
  });
}
export async function confirmAlarmAPI(params?: { alarmID: string }) {
  return request<API.APIReturnType<any>>('/api/alarm/confirmAlarm', {
    method: 'post',
    data: params || {},
  });
}
export async function queryHisAlarmPieAPI() {
  return request<API.APIReturnType<any>>('/api/alarm/hisAlarmPie');
}
